package com.g4m.baselib.fiter;

import org.slf4j.MDC;
import org.springframework.core.Ordered;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 *  haosenwei[haosenwei@dubmic.com]
 *  10/01/2021 01:03
 * <p>Copyright 2008-2019 snsndk.com</p>
 */
@Component
//public class HttpFilter implements GlobalFilter, Ordered {
public class HttpFilter {
//    @Override
//    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
//        //获取请求
//        ServerHttpRequest request = exchange.getRequest();
//        //获取uuid
//        String traceId = UUIDUtil.getUUID();
//        MDC.put("traceId", traceId);
//        //添加请求头
//        ServerHttpRequest addHeader = request.mutate().header("traceId", traceId).build();
//        ServerWebExchange build = exchange.mutate().request(addHeader).build();
//        return chain.filter(build);
//    }

//    @Override
//    public int getOrder() {
//        return 0;
//    }
}
